<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>if、if/else、三元表达式流程控制</title>
  </head>
  <body>
    <script>
      //   var sex = "boy";
      //   if (sex === "boy") {
      //     console.log("Hello, I am a boy!");
      //   }
      //   if (sex === "boy") console.log("Hello, I am a boy!");
      //   var sex = "girl";
      //   if (sex === "boy") {
      //     console.log("Hello, I am a boy!");
      //   } else {
      //     console.log("Hello, I am a girl!");
      //   }
      //   var age = 18;
      //   if (age < 18) {
      //     console.log("我是未成年!");
      //   } else if (age === 18) {
      //     console.log("今年我18岁了!");
      //   } else {
      //     console.log("我已经是成年人了!");
      //   }
      var sex = "boy";
      sex === "boy"
        ? console.log("Hello, I am a boy!")
        : console.log("Hello, I am a girl!");
    </script>
  </body>
</html>
